<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <script type="text/javascript">
        window.onload = function () {
            /*   
                函数传参数 
                function fnMyalert(a){
                    alert(a);
                }

                fnMyalert('hello world!'); 
            */


            function fnChangestyle(mystyle, val) {
                var oDiv = document.getElementById('div1');
                oDiv.style[mystyle] = val;
            }
            fnChangestyle("fontSize", '30px');
            fnChangestyle("color", 'red');
            fnChangestyle("backgroundColor", 'pink');

        }
    </script>
    <title>Document</title>
</head>

<body>
    <div id="div1">这是一个DIV 元素</div>


</body>

</html>